package com.hornsun.prescription.service;

import com.hornsun.domain.dbo.Prescription;
import com.hornsun.repository.PrescriptionRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

/**
 * Created by 编译中... on 2018/1/29.
 */
@Service
    public class PrescriptionService {
    @Autowired
    private PrescriptionRepository prescriptionRepository;
    /**
     *增加处方记录
     */
    public void addPrescription(Prescription prescription){
        int count=prescriptionRepository.insertPrescription(prescription);
        if (count!=1){
            throw new RuntimeException("insert prescription failed");
        }
    }

    /**
     * 查询处方
     */
    public Prescription queryPrescription(String guid){
        return prescriptionRepository.getPrescription(guid);
    }

}
